<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function* anotherGenerator(x) {
        yield x + 2
        yield x + 3
        yield x + 4
      }

      const generator = anotherGenerator(1)
      // console.log(generator.next())
      // console.log(generator.next())
      // console.log(generator.next())
      for (const value of generator) {
        console.log(value)
      }
      // 3 4 5
    </script>
  </body>
</html>
